﻿using LogSystem;
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
using Yoozoo.Gameplay.Liberty.AI.Utils;

namespace Yoozoo.Gameplay.Liberty.AI.Node
{
    [Category("Ggame/Liberty")]
    public class NpcSwitchTarget : AIBaseNode
    {
        public BBParameter<TargetType> switchTargetType = TargetType.RevengeTarget;
        
        protected override void OnExecute()
        {
            AIEntity target = _entity.battleAgent.GetTarget(switchTargetType.value);
            if (target && !_entity.battleAgent.ignoreTargets.Contains(target))
            {
                _entity.battleAgent.currentLockTarget = target;
                EndAction(true);
            }
            else
            {
                EndAction(false);
            }            
        }
        
    }
}